package com.example.lenovo.test1;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.ViewFlipper;

import java.util.ArrayList;

public class Main8Activity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main8);
        ViewFlipper mviewFlipper = findViewById(R.id.view_flipper);
        ArrayList<String> mListValue =new ArrayList<>();
        mListValue.add("Item111");
        mListValue.add("Item222");
        mListValue.add("Item333");
        mListValue.add("Item444");
        for (String textTitle:mListValue) {
            TextView textView = new TextView(this);
            textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));
            textView.setEllipsize(TextUtils.TruncateAt.MIDDLE);
            textView.setGravity(Gravity.CENTER);
            textView.setSingleLine(true);
            //textView.setTextColor(getResources().getColor(R.color.animation_textview_color));
            textView.setTextSize(16);
            textView.setText(textTitle);
            mviewFlipper.addView(textView);
        }
    }
}
